package com.yunhe.authority.domain.company;

import com.yunhe.authority.domain.authority.ProjectTree;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @ClassName ProjectCompanyTree
 * @Description TODO
 * @Author HeTao
 * @Date 2021/7/14 10:01
 * @Version 1.0
 **/
@ApiModel(value = "ProjectCompanyTree", description = "项目企业树对象")
@Data
public class ProjectCompanyTree implements Serializable {
    @ApiModelProperty("id")
    private Long id;

    @ApiModelProperty("code")
    private String code;

    @ApiModelProperty("标题")
    private String title;

    @ApiModelProperty("类型")
    private  String type;

    @ApiModelProperty("父id")
    private Long parentId;

    @ApiModelProperty("层级")
    private Integer level;

    @ApiModelProperty("icon标志")
    private String iconFlag;

    @ApiModelProperty("子节点")
    private List<ProjectCompanyTree> children;

    public void addChild(ProjectCompanyTree deviceTree) {
        if (this.children == null) {
            this.children = new ArrayList<>();
        }
        this.children.add(deviceTree);
    }
}
